//完成与角色表相关的操作
const db = require('./db.js')

//根据角色id从sp_role表中获得角色对应的权限id列表
module.exports.getPsidsByRid = async (rid) =>{
	return await db.q('select ps_ids from sp_role where role_id=?',rid)
}

//获取所有角色
module.exports.getAllRoles = async () =>{
	return await db.q('select role_id,role_name,role_desc from sp_role',null);
}
module.exports.delOnePerm =  async (permInfo) =>{
	return await db.q('update sp_role set ps_ids=? where role_id=?',permInfo);
}
module.exports.updatePerm = async (permInfo) =>{
	return await db.q('update sp_role set ps_ids=? where role_id=?',permInfo)
}